package com.neuedu.hw_20190215;

public class StudentTestDriver {

    public static void main(String[] args) {
        //为StudentInformation类创建对象
        StudentInformation stuinf = new StudentInformation();
        //为英语系学生信息赋值
        EnglishDepartment english0 = new EnglishDepartment("2015156141"+stuinf.randomId(), "张三", "男", stuinf.randomAge(), stuinf.randomScore(), stuinf.randomScore(), stuinf.randomScore());
        EnglishDepartment english1 = new EnglishDepartment("2015156141"+stuinf.randomId(), "赵柳", "女", stuinf.randomAge(), stuinf.randomScore(), stuinf.randomScore(), stuinf.randomScore());
        //为计算机系学生信息赋值
        ComputerDepartment computer0 = new ComputerDepartment("2015156141"+stuinf.randomId(), "李四", "女", stuinf.randomAge(),  stuinf.randomScore(), stuinf.randomScore(), stuinf.randomScore(), stuinf.randomScore());
        ComputerDepartment computer1 = new ComputerDepartment("2015156141"+stuinf.randomId(), "欧阳靖", "男", stuinf.randomAge(),  stuinf.randomScore(), stuinf.randomScore(), stuinf.randomScore(), stuinf.randomScore());
        //为文学系学生信息赋值
        LiteratureDepartment literature = new LiteratureDepartment("2015156141"+stuinf.randomId(), "胡三", "男", stuinf.randomAge(), stuinf.randomScore(), stuinf.randomScore(), stuinf.randomScore(),stuinf.randomScore());
        //定义一个可容纳5个学生的学生类数组
        //此处用到多态
        StudentPrint studentPrint = new StudentPrint();
        Student[] stu = new Student[5];
        stu[0] = english0;
        stu[0].setStuTotalScore(english0.totalscore());    //给总成绩赋值
        stu[1] = computer0;
        stu[1].setStuTotalScore(computer0.totalscore());   //给总成绩赋值
        stu[2] = english1;
        stu[2].setStuTotalScore(english1.totalscore());    //给总成绩赋值
        stu[3] = computer1;
        stu[3].setStuTotalScore(computer1.totalscore());   //给总成绩赋值
        stu[4] = literature;
        stu[4].setStuTotalScore(literature.totalscore());   //给总成绩赋值
        for (int i = 0; i < stu.length; i++) {
            // 设置打印学生信息属性的值
            studentPrint.setStudent(stu[i]);
            // 打印学生信息
            studentPrint.printEmployeeSalary();
        }
    }



}
